/* --------------------------------------------------------
 * Copyright (c) aeky , Inc.  All rights reserved.
 * --------------------------------------------------------
 */
package com.aeky.domain;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Where;

/**
 * 部门表
 * 
 * @author aeky
 */
@Entity
@Table(name = "T_SYS_DEPT")
public class Department {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "DEPT_ID", nullable = false, unique = true)
    private Long deptId;

    @Column(name = "DEPT_NAME")
    private String deptName;

    @Column(name = "DEPT_PARENT_ID")
    private Long deptParentId;

    @Column(name = "ORG_ID")
    private Long orgId;

    @Column(name = "TEL_NO")
    private String telNo;

    @Column(name = "FAX_NO")
    private String faxNo;

    @Column(name = "DEPT_FUNCTION_DESC")
    private String deptFunctionDesc;

    @Column(name = "DEPT_CODE")
    private String deptCode;

    @Column(name = "IS_VALID")
    private String isValid;

    @OneToMany(fetch = FetchType.EAGER)
    @JoinColumn(name = "DEPT_PARENT_ID", insertable = false, updatable = false)
    @Where(clause = "IS_VALID = 1")
    private List<Department> deptList = new ArrayList<Department>();

    /**
     * @return the deptId
     */
    public Long getDeptId() {
        return deptId;
    }

    /**
     * @param deptId the deptId to set
     */
    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }

    /**
     * @return the deptName
     */
    public String getDeptName() {
        return deptName;
    }

    /**
     * @param deptName the deptName to set
     */
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    /**
     * @return the deptParentId
     */
    public Long getDeptParentId() {
        return deptParentId;
    }

    /**
     * @param deptParentId the deptParentId to set
     */
    public void setDeptParentId(Long deptParentId) {
        this.deptParentId = deptParentId;
    }

    /**
     * @return the orgId
     */
    public Long getOrgId() {
        return orgId;
    }

    /**
     * @param orgId the orgId to set
     */
    public void setOrgId(Long orgId) {
        this.orgId = orgId;
    }

    /**
     * @return the telNo
     */
    public String getTelNo() {
        return telNo;
    }

    /**
     * @param telNo the telNo to set
     */
    public void setTelNo(String telNo) {
        this.telNo = telNo;
    }

    /**
     * @return the faxNo
     */
    public String getFaxNo() {
        return faxNo;
    }

    /**
     * @param faxNo the faxNo to set
     */
    public void setFaxNo(String faxNo) {
        this.faxNo = faxNo;
    }

    /**
     * @return the deptFunctionDesc
     */
    public String getDeptFunctionDesc() {
        return deptFunctionDesc;
    }

    /**
     * @param deptFunctionDesc the deptFunctionDesc to set
     */
    public void setDeptFunctionDesc(String deptFunctionDesc) {
        this.deptFunctionDesc = deptFunctionDesc;
    }

    /**
     * @return the deptCode
     */
    public String getDeptCode() {
        return deptCode;
    }

    /**
     * @param deptCode the deptCode to set
     */
    public void setDeptCode(String deptCode) {
        this.deptCode = deptCode;
    }

    /**
     * @return the isValid
     */
    public String getIsValid() {
        return isValid;
    }

    /**
     * @param isValid the isValid to set
     */
    public void setIsValid(String isValid) {
        this.isValid = isValid;
    }

    /**
     * @return the deptList
     */
    public List<Department> getDeptList() {
        return deptList;
    }

    /**
     * @param deptList the deptList to set
     */
    public void setDeptList(List<Department> deptList) {
        this.deptList = deptList;
    }

}
